﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="treeJqueryList.aspx.cs"
    Inherits="Rmlife.Web.Systems.cosmelist.treeJqueryList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>JQuery树形菜单</title>
    <link href="css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
    <link href="css/demo.css" rel="stylesheet" />
    <script src="js/jquery-1.7.1.js" type="text/javascript"></script>
    <script src="js/jquery.ztree.all-3.5.js" type="text/javascript"></script>
    <script src="/js/GerryUICommon.js" type="text/javascript"></script>
    <script type="text/javascript">
        <!--
        var setting = {
            view: {
                showIcon: false
            },
            callback: {
                onRightClick: zTreeOnRightClick
            },
            check: {
                enable: true,
                nocheckInherit: true
            },
            data: {
                simpleData: {
                    enable: true
                }

            }
        };

        var zNodes = [];

        $(document).ready(function () {
            var tree;
            Ajax.Post("/Tools/Handlers/cosmelistHandler.ashx", { act: "getTreeList" }, function (data) {
                //alert(data);
                if (data != '') {
                    console.log(data.toString());
                    tree = $.fn.zTree.init($("#treeDemo"), setting, eval(data));
                    console.log(zNodes.toString());
                }
                else
                    alert("111");
            }, function () {
                alert("22");
            });
            //alert(zNodes);
//            var tree = $.fn.zTree.init($("#treeDemo"), setting, zNodes);
            $("#show").click(function () {
                var node = tree.getCheckedNodes();
                $.each(node, function () {
                    alert(this.id);
                });
                //var node2 = tree.getChangeCheckedNodes();
                //$.each(node2, function () {
                //    alert(this.name);
                //});
            });
        });

        function zTreeOnRightClick() {

        }
    //-->
    </script>
</head>
<body>
    <div>
        <ul id="treeDemo" class="ztree">
        </ul>
    </div>
    <input type="button" id="show" value="ok" />
</body>
</html>
